▍ humdrum codex / sportsball v0.1.0
license AGPL-3.0
3.7 KB raw
id
TASK-019
title
Seasonal league handling (auto-hide off-season + quadrennial events)
status
🏁 Done
assignee
created_date
2026-06-17 23:22
updated_date
2026-06-18 01:17
labels
feature
dependencies
priority
medium
ordinal
19000

Description

Leagues clutter the tab bar when out of season. Auto-hide a league when it has no games within ~-30/+30 days of now (its last/next game), surfacing it only when active. Special-case rare events: World Cup, Olympics, etc. recur every ~4 years and should stay hidden until in window. This is distinct from TASK-002's manual enable/disable: manual choice should still override (user can force-show or force-hide). Likely a derived 'in season' flag on the effective league set, computed from the fetched window / a schedule probe, applied in App.leagues resolution.

Acceptance Criteria

Implementation Notes

Reworking auto-vs-manual flip into a per-league override model: auto-by-season always on; config carries force-hide + force-show sets + a display order. Effective visible = (inSeason OR forceShow) AND NOT forceHide. Toggling back to auto's choice clears the override (returns that league to auto, doesn't pin it). Hiding one league no longer disables auto-hide for the rest.

Refactored to per-league overrides (no global auto/manual flip). visible(l)=(inSeason OR forceShow) AND NOT forceHide. config now stores LeagueOrder + HideLeagues + ShowLeagues. toggleLeagueVisibility clears the override when the desired state matches the season default, so hiding ONE league no longer disables auto-hide for the rest; '0' clears all overrides. Tests rewritten for the new API (orderedCatalog, applyAutoLeagues, overrides-beat-season, toggle-clears-to-auto, moveLeague). go test ./... passes.

Final Summary

Seasonal auto-hide: off-season leagues drop out of the tabs and all views automatically, returning when in range.

What:

Verified live (June 2026): NFL probes 0 games in +/-30d -> auto-hidden; MLB/WNBA/World Cup/NBA/NHL in season. Unit tests cover the in-season derivation (catalog order, unprobed=in-season) and the never-blank fallback. go vet + go test ./... pass.